package org.nstack.header.host;

import org.nstack.header.message.APIDeleteMessage;
import org.nstack.header.message.APIEvent;
import org.nstack.header.message.APIMessage;
import org.nstack.header.message.APIParam;
import org.nstack.header.rest.RestRequest;
import org.springframework.http.HttpMethod;
import org.nstack.header.notification.ApiNotification;



@RestRequest(
        path = "/hosts/{uuid}",
        method = HttpMethod.DELETE,
        responseClass = APIDeleteHostEvent.class
)
public class APIDeleteHostMsg extends APIDeleteMessage implements HostMessage {

    @APIParam
    private String uuid;

    public APIDeleteHostMsg() {
    }

    public APIDeleteHostMsg(String uuid) {
        this.uuid = uuid;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    @Override
    public String getHostUuid() {
        return getUuid();
    }
 
    public static APIDeleteHostMsg __example__() {
        APIDeleteHostMsg msg = new APIDeleteHostMsg();
        msg.setUuid(uuid());
        msg.setDeletionMode(DeletionMode.Permissive);
        return msg;
    }

    public ApiNotification __notification__() {
        APIMessage that = this;

        return new ApiNotification() {
            @Override
            public void after(APIEvent evt) {
                ntfy("Deleted").resource(uuid, HostVO.class.getSimpleName())
                        .messageAndEvent(that, evt).done();
            }
        };
    }

}
